import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '@/views/Home/home.vue'
import indexView from '@/views/Home/index.vue'
import claView from '@/views/Home/cla.vue'
import cartView from '@/views/Home/cart.vue'
import myView from '@/views/Home/cart.vue'
import searchView from '@/views/Search/index.vue'
import goodsView from '@/views/goods/index.vue'
import detailView from '@/views/detail/index.vue'
import orderView from '@/views/order/index.vue'
import orderdetailView from '@/views/order/index.vue'
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    { path: '/', redirect: '/home/index' },
    {
      path: '/home', name: 'home', component: HomeView, children: [
        { path: 'index', name: 'index', component: indexView },
        { path: 'cla', name: 'cla', component: claView },
        { path: 'cart', name: 'cart', component: cartView },
        { path: 'my', name: 'my', component: myView },
      ]
    },
    { path: '/search', name: 'search', component: searchView },
    { path: '/goods/:query', name: 'goods', component: goodsView },
    { path: '/detail/:goods_id', name: 'detail', component: detailView },
    { path: '/order', name: 'order', component: orderView },
    { path: '/orderdetail/:orderId', name: 'orderdetail', component: orderdetailView },
  ],
})

export default router
